//package com.brkj.course;
//
//
//import java.util.List;
//
//import us.costan.chrome.ChromeSettings;
//import us.costan.chrome.ChromeView;
//import us.costan.chrome.ChromeWebClient;
//
//import com.brkj.main.R;
//import com.brkj.util.Util;
//import com.brkj.util.view.BaseActivity;
//
//import android.annotation.SuppressLint;
//import android.content.Intent;
//import android.content.pm.PackageInfo;
//import android.content.pm.PackageManager;
//import android.content.res.Configuration;
//import android.net.Uri;
//import android.os.Bundle;
//import android.os.Handler;
//import android.webkit.CookieManager;
//import android.webkit.CookieSyncManager;
//import android.webkit.WebSettings;
//import android.webkit.WebView;
//import android.webkit.WebViewClient;
//import android.webkit.WebViewDatabase;
//import android.webkit.WebSettings.PluginState;
//
//
//public class WebViewChromeActivity extends BaseActivity {
//
//	private ChromeView web_view;
//	private String url;
//	private final Handler handler = new Handler();
//	
//	@Override
//	public void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		setContentView(R.layout.webview);
////		clearCookie();
//		getData();
//		initView();
//	}
//	private void clearCookie(){
//		//经过查资料和stream指导，发现在用CookieManager操作Cookie前需要进行Cookie同步，只要在CookieManager.getInstance().setCookie(serverName, "")前添加如下代码，问题便可解决：
//		try {
//			CookieSyncManager.createInstance(this);
//			CookieSyncManager.getInstance().startSync();
//			CookieManager.getInstance().removeAllCookie();
//			CookieManager.getInstance().removeExpiredCookie();
//			CookieManager.getInstance().removeSessionCookie();
//			WebViewDatabase.getInstance(this).clearUsernamePassword();
//			WebViewDatabase.getInstance(this).clearHttpAuthUsernamePassword();
//		} catch (Exception e) {
//			// TODO: handle exception
//		} catch(Error er){
//
//		}
//	}
//	private void getData() {
//		Intent intent = getIntent();
//		url = intent.getStringExtra("url");
//	}
//
//	private void initView() {
//		setActivityTitle("课程内容");
//		setReturnBtn();
//		
////		web_view = (WebView) findViewById(R.id.webView);
////		
//		
//		web_view = (ChromeView)findViewById(R.id.webView);
//		web_view.getSettings().setJavaScriptEnabled(true);
//		loadWeb();
////		chromeView.loadUrl("http://www.baidu.com");
//		
//	}
//
//	@SuppressLint("NewApi")
//	private void loadWeb() {
//		
//		ChromeSettings setting=web_view.getSettings();
//		setting.setPluginState(PluginState.ON);
//		setting.setJavaScriptEnabled(true);
//		
//		setting.setUseWideViewPort(true);
//		setting.setBuiltInZoomControls(true);
//		setting.setSupportZoom(true);
//		setting.setLoadWithOverviewMode(true);
//		setting.setDefaultTextEncodingName("utf-8");
//
//		if (url != null && !url.equals("")) {
//			web_view.loadUrl("http://html5test.com/");
////			web_view.loadUrl("http://118.192.9.79:85/3g/page1501.html");
////			web_view.loadUrl("http://118.192.9.79:85/energysaving/index.html");
///*		检测是否安装有flash插件	
//			if(check()){
////				String url="file:///android_asset/a.swf";
////				String url="http://118.192.9.79:99/html";
////				String url="http://118.192.9.79:85/ROI1/";
//				web_view.loadUrl(url);
//			}else{
//				install();
//			}
//			*/
//		}
//		
////		web_view.setWebViewClient(new WebViewClient() {
////		@Override
////		public boolean shouldOverrideUrlLoading(WebView view, String url) {
////			if((url!= null) && (url.equals(""))){
////				web_view.loadUrl(url);
////			}else{
////				return false;
////			}
////			
////			return true;
////		}
////	});
//		
////		web_view.setChromeWebClient(new ChromeWebClient(){
////			
////		});
//	}
//
//	
//	private boolean check() {
//		PackageManager pm = getPackageManager();
//		List<PackageInfo> infoList = pm
//				.getInstalledPackages(PackageManager.GET_SERVICES);
//		for (PackageInfo info : infoList) {
//			if ("com.adobe.flashplayer".equals(info.packageName)) {
//				return true;
//			}
//		}
//		return false;
//	}
//	
//	private class AndroidBridge {
//		public void goMarket() {
//			handler.post(new Runnable() {
//				public void run() {
//					Intent installIntent = new Intent(
//							"android.intent.action.VIEW");
//					installIntent.setData(Uri
//							.parse("market://details?id=com.adobe.flashplayer"));
//					startActivity(installIntent);
//				}
//			});
//		}
//	}
//	@SuppressLint("JavascriptInterface")
//	private void install() {
//		web_view.addJavascriptInterface(new AndroidBridge(), "android");
//		web_view.loadUrl("file:///android_asset/go_market.html");
//	}
//
//	public void onPause() {
//		super.onPause();
//		web_view.onPause();
//	}
//	
//	public void onResume() {//继承自Activity
//		super.onResume();
//		web_view.onResume();
//	}
//	
//	@Override
//	public void finish() {
//		
//		//停止播放flash
////		web_view.pauseTimers();
////		web_view.stopLoading();
//		web_view.loadData("<a></a>", "text/html", "utf-8");
//		
//		super.finish();
//
//	}
//	
////	@Override
////	public void onConfigurationChanged(Configuration newConfig) {
////		if (newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE) {
////			setContentView(R.layout.webview);
////			//横屏
////			} else {
////			setContentView(R.layout.webview);//竖屏
////			}
////		super.onConfigurationChanged(newConfig);
////	}
//}
